<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Cat(name,color){
            this.name = name
            this.color = color
        }
        //构造函数创建对象
        //构造函数要使用new关键字调用
        let dog = new Cat('旺财','白色')
        let cat = new Cat('小白','黑色')
        console.log(dog);
        console.log(cat);

        function Car(name,brand,price){
            this.name = name
            this.brand = brand
            this.price = price
        }
        let car1 = new Car('小白','宝马','50w')
        let car2 = new Car('小黑','奔驰','60w')
        console.log(car1);
        console.log(car2);
    </script>
</body>
</html>